{% extends "based/based.html" %}
{% block title %}{{_("视频库")}}-{% endblock %}
{% block content %}
<data id="cid" content="{{data.cid}}"></data>
<div id="app" >
    <div class="row">
        <div class="col-xs-12">
            <div class="panel">
                <header class="panel-heading">
                    <i class="fa fa-youtube-play"></i>
                    <strong>
                        {{_("视频库")}}(<span class="osr-color-success">{{_("结果")}}{[medias.data_total]}</span>)
                    </strong>
                </header>
                <div class="panel-body table-responsive">
                    {% include 'media/_bar.html' %}
                     <!-- 上传-->
                    <div id="upload-html" hidden>
                        {% include 'module/upload.html' %}
                    </div>
                    <!-- //上传-->

                    <div v-for="(media, index) in medias.datas" class="osr-img-list col-lg-3 col-md-4 col-sm-6 col-xs-12">
                        <span class="osr-img-tag-media">
                          <span  v-if="media.category" class="badge badge-info">
                              {[media.category]}
                          </span>
                          <span  v-else class="badge badge-info text-danger">
                              {{_("未分类")}}
                          </span>
                        </span>
                        <img class="osr-media-img" src="/static/sys_imgs/video-play.png"  :alt="media.title">
                        <div v-if="media.title" class="img-title osr-text-overleft"  data-toggle="tooltip" :title="media.title">
                              <a class="fa fa-play-circle-o"  target="_blank" :href="'/osr-admin/media/video-play?id='+media._id+'&name='+media.name"></a>
                            {[media.title]}
                         </div>
                        <div v-else class="img-title">
                            <a class="fa fa-play-circle-o"  target="_blank" :href="'/osr-admin/media/video-play?id='+media._id+'&name='+media.name"></a>
                            &nbsp;
                        </div>

                         <div class="osr-text-overleft" data-toggle="tooltip" :title="media.name">
                            {[media.name]}
                        </div>

                          <span class="checkbox checkbox-success">
                               <input :id="media._id" type="checkbox"  v-bind:value="media._id" unchecked>
                               <label :for="media._id"></label>
                              <a class="pull-right" :href="'/osr-admin/media/video-edit?cid='+curren_category+'&id='+media._id+'&fp='+page" a>
                                    <i class="fa fa-edit"></i>{{_("编辑|详情")}}
                              </a>
                          </span>
                        <span class="osr-date">
                            <span v-if="media.inform" class="fa fa-warning osr-color-danger osr-pointer"
                                    v-on:click="put_media_view(media.inform)" data-toggle="modal" data-target="#inform-info">
                                  {[media.inform.total]}
                            </span>
                            &nbsp;
                            {[media.time | formatDate]}{{_("上传")}}
                        </span>
                        <hr>
                    </div>
                </div>
                {% include 'media/_paging.html' %}
            </div>
        </div>
    </div>
</div>

<script>

    var vue = new Vue({
      el: '#app',
      delimiters:['{[', ']}'],
      data:{
          media_type:"video",
          medias:[],
          page:1,
          media_view:{},
          media_edit:{},
          media_categorys:[],
          curren_category:"",
          start_upload:false,
          checkAll:false, set:false,
          keyword:"",
          img_height:"140px",
          pages:{}
      },
      filters: {
            formatDate: function (time) {
              return irrformatDate(time, "yyyy-MM-dd hh:mm");
            }
      }
    })

    var upload_data = {
        name:"批量上传",
        ctype:vue.media_type,
        batch:1,
        category_name:"默认"
    }

    //文件上传配置
    function uploader_conf(data){

        var conf = {
            pick: {
                id: '#filePicker',
                label: '{{_("点击选择视频")}}'
            },
            formData:data,
            fileVal: "upfile",
            dnd: '#dndArea',
            paste: '#uploader',
            swf: '../../dist/Uploader.swf',
            chunked: false,
            chunkSize: 512 * 1024,
            server: "/api/admin/upload/media-file",
            // 禁掉全局的拖拽功能。这样不会出现图片拖进页面的时候，把图片打开。
            disableGlobalDnd: true,
            fileNumLimit: 10,
            fileSizeLimit:4000 * 1024 * 1024,    // 4000 M
            fileSingleSizeLimit:2000 * 1024 * 1024    // 1000 M
        }
        return conf;
    }

</script>
    {% include 'media/_script.html' %}
{% endblock %}
